from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from config import Config
import docker
from flasgger import Swagger


db = SQLAlchemy()
DOCKER_CLIENT = docker.from_env()
def create_app():
    app = Flask(__name__)

    app.config.from_object(Config)
    db.init_app(app)

    # 配置 Swagger
    Swagger(app)

    # 注册蓝图，容器
    from app.routes.container_routes import container_bp
    app.register_blueprint(container_bp)


    # 注册蓝图，swagger
    from app.routes.swagger_routes import swagger_bp
    app.register_blueprint(swagger_bp)


    return app